/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ticks.PID.subsystems;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.command.Subsystem;
import java.util.TimerTask;

/**
 *
 * @author Jared
 */
public class Arm extends Subsystem {
    java.util.Timer limitTimer;
    DigitalInput upperLimit;
    DigitalInput lowerLimit;
    double motorSpeed;
    public Arm(){
        limitTimer = new java.util.Timer();
        upperLimit = new DigitalInput(1);
        lowerLimit = new DigitalInput(2);
        
    }
    private class checkLimits extends TimerTask{

        public void run() {
            if(upperLimit()||lowerLimit()){
                setMotor(0, true, true);
            }else{
                setMotor(getMotor(), false, true);
            }
        }
        
    }
    synchronized public void setMotor(double speed, boolean atLimit, boolean checker){
        if(!atLimit&&checker){
            motorSpeed = speed;
        }else{
            motorSpeed = 0;
        }
        
    }
    synchronized public double getMotor(){
        return 0;
    }
    
    synchronized public boolean upperLimit(){
        return upperLimit.get();
    }
    
    synchronized boolean lowerLimit(){
        return lowerLimit.get();
    }
    // Put methods for controlling this subsystem
    // here. Call these from Commands.

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    }
}
